/** 
* @file cpu.h
* Processor Interface implementation.
* Provides the interface for managing processors, processor cores,
* accessing processors sturctures.
* Everything outside of this module must use this interface when 
* working with processors.
*
* Copyrights 2010 Michal Saman, m.saman@designplus.cz.
* This source code is release under the Apache License 2.0.
* http://www.apache.org/licenses/LICENSE-2.0
*/

#ifndef _CPU_H
#define	_CPU_H

#ifndef ARCH_X86
#error "[cpu.h] is is platform-independent. Define ARCH_X86."
#endif

extern int cpu_init();
extern void cpu_shutdown();

/** INLINE FUNCTIONS **/

/**
 * Halt CPU until some interrupt occurs.
 */
static __inline__ void cpu_halt() {
	__asm__ volatile ("hlt");
}


#define save_all_regs() \
	__asm__ volatile ("pushal");

#define restore_all_regs() \
	__asm__ volatile ("popal");

#endif
